package com.mycompany.app.hr.eleave.service.leavepolicy.impl;

import com.mycompany.app.hr.eleave.exception.LeaveValidationException;
import com.mycompany.app.hr.eleave.model.LeaveApplication;
import com.mycompany.app.hr.eleave.service.leavepolicy.ILeavePolicyCheck;
import com.mycompany.app.hr.pa.model.Employee;

/**
 * 难产假 Female <=15 days
 * 
 * @author Shawn.guo
 */
public class DystociaLeaveCheck implements ILeavePolicyCheck {

    public void check(Employee employee, LeaveApplication app)
            throws LeaveValidationException {

        if ("M".equalsIgnoreCase(employee.getBasicInfo().getSex())
                || app.calculateCalendarDays() > 15)
            throw new LeaveValidationException(
                    LeaveValidationException.DYSTOCIA);

    }

}
